// @flow
import React, { Component } from 'react'

type Props = {
  data: Object,
  goToDeviceOverView: Function
}
class LinkToDeviceOverView extends Component {
  props: Props
  goToLink: Function
  constructor (props: Props) {
    super(props)
    this.goToLink = this.goToLink.bind(this)
  }

  goToLink () {
    const { data, goToDeviceOverView } = this.props
    goToDeviceOverView(data)
  }
  render () {
    const name = this.props.data.eventName
    return (
      <a onClick={this.goToLink}>
        {name}
      </a>
    )
  }
}

export default LinkToDeviceOverView
